<?php
/**
 * 站内搜索保存block文件
 *
 * @author		Arthur(ArthurXF@gmail.com)
 * @copyright	(c) 2006 by bizeway.com
 * @version		$Id$
 * @package		ArthurXF
 * @subpackage	keywords
 */
if (is_object($objWebInit)) {
	if(!isset($objkeywords)){
		include_once(__WEB_ROOT."/keywords/class/keywords.class.php");
		include_once(__WEB_ROOT."/keywords/config/var.inc.php");
		$objkeywords =& new keywords();
		$objkeywords->setDBG($arrGPdoDB);
		if(is_object($objWebInit->db)) $objkeywords->db = $objWebInit->db;
		else $objkeywords->db();
	}

	$strKeywords = strval(urldecode($_REQUEST['keywords']));
	$arrKeywords = explode(' ',$strKeywords);
	foreach($arrKeywords as $v){
		$arrSave = array();
		$arrSave['title'] = $v;
		$arrSave['title_md5'] = md5($v);
		$strWhere = "where  title_md5 = '".$arrSave['title_md5']."' and submit_date = '".date('Y-m-d')."'";
		$arrRecord = $objkeywords->getInfoWhere($strWhere);

		if(empty($arrRecord)){
			$arrSave['clicktimes'] = 1;
			$objkeywords->saveInfo($arrSave ,0,false);
		}else{
			$objkeywords->updateClicktimes($strWhere);
		}

	}

}
?>